package IHM;



import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.util.ArrayList;
//import com.sun.tools.javac.util.Pair;

import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.JToolBar;


import Controller.gestControler;
import Modele.Pair;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;

import Modele.gestModele;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;

import javax.swing.JScrollPane;
/**
 * Ceci est la classe de construction de la fenêtre graphique principale du programme.
 * @author philippestepniewski
 */

@SuppressWarnings("serial")
public class Fenetre extends JFrame {

	private JPanel middlebas,middlebasup,entreeSortie,panneauGauche,imEntree,panneauControl,param,haut,bas,milieu,sparsePan,chargeSparse,sparseApp,sparseTest;
	private JPanel champsnbcouches;
	private JPanel champs=new JPanel();
	private JPanel nonsparseAppY;
	private JPanel nonsparseTestY;
	private JPanel nonsparseApp;
	private JPanel nonchargeSparse;
	private JPanel nonsparseTest;


	private JButton itesuivante;
	private JButton iteprecedante;
	private JButton exemplesuivant;
	private JButton exempleprecedent;
	private JButton play, cancel, genererExp;
	private JButton nonsparseChooserBoutonTest;
	private JButton nonsparseChooserBoutonApp;
	private JButton nonsparseChooserBoutonTestY;
	private JButton nonsparseChooserBoutonAppY;
	private JButton sparseChooserBoutonApp;
	private JButton sparseChooserBoutonTest;
	private JButton genererData;

	private JTextField learningRate;
	private JTextField nonsparseChooserFieldApp;
	private JTextField nonsparseChooserFieldTest;
	private JTextField nonsparseChooserFieldAppY;
	private JTextField nonsparseChooserFieldTestY;
	private JTextField nbCouchesJTF,nomExperience,nbInput,nbSortie;
	private JTextField jlabclassif;
	private JTextField sparseChooserFieldTest;
	private JTextField sparseChooserFieldApp;
	private ArrayList<JTextField> jtf;

	private JLabel trainBoxLab;
	private JLabel autoEncodeBoxLab;
	private JLabel saveBoxLab;
	private JLabel learningRatelab;
	private JTextField imgEntree;
	private JLabel nonsparseChooserLabTest;
	private JLabel nonsparseChooserLabApp;
	private JLabel nonsparseChooserLabTestY;
	private JLabel nonsparseChooserLabAppY;
	private JLabel nbCouchesLab,nomExperienceLab,nbInputLab,nbSortieLab,SparseLab,jlabentree,jlabsortie;
	private JLabel sparseChooserLabApp;
	private JLabel sparseChooserLabTest;
	private ArrayList<JLabel> label;

	private String entree;
	private String sortie;
	private String chemainFichierXApp;
	private String chemainFichierYApp;
	private String nomExp;
	private String chemainFichierXTest;
	private String chemainFichierYTest;
	private ArrayList<String> liste_chemin ;

	private int iterationActuel=0;
	private int exempleActuel=0;
	private int HORIZONTAL;
	private int nbIterationsMax;
	private int nbCouches;
	private ArrayList<Integer> paramCouches;
	private int nbIn;
	private int nbOut;


	private double epsilon;
	private boolean autoEncode;
	private boolean save;
	private boolean train;

	private JMenuBar menuBar;
	private JMenu fichier = new JMenu("Fichier");
	private JMenuItem ouvrir = new JMenuItem("Ouvrir");
	private JMenuItem nouveau = new JMenuItem("Nouveau");
	private JMenuItem sauver = new JMenuItem("Enregistrer");
	private JMenuItem fermer = new JMenuItem("Fermer");
	private JMenu edition = new JMenu("Edition");
	private JMenuItem charger = new JMenuItem("Charger une base de données");
	
	private JFileChooser sparseChooser;
	private JFileChooser nonsparseChooser;
	private Font police;
	private JToolBar toolBar= new JToolBar();;
	private JSplitPane split,split1;
	private JScrollPane couchesScrollBar;
	private JCheckBox sparse;
	private JCheckBox saveBox;
	private JCheckBox autoEncodeBox;
	private JCheckBox trainBox;
	private JCheckBox PMCBox;
	private Cachees couches;
	private Stats stats;

	private gestControler contr;
	private int nbExempleMax;
	private boolean sparsebool;
	private JPanel statfree;
	private JScrollPane statfreeScrollBar;
	private ArrayList<ArrayList<ArrayList<double[]>>> activations;
	private ArrayList<ArrayList<ArrayList<int[]>>> ArrayStats;
	private ArrayList<Couche> listePanCouches ;
	private ArrayList<Double> ArrayErreur;
	private JPanel statcourbe;
	private boolean alterneStat=true;
	private JLabel PMCBoxLab;
	private JTextField nomPMCField;
	private JLabel nomPMCLab;
	private String nomPMC;
	private JPanel champschargePMC;
	private JButton PMCChoose;
	private String cheminFichierPMC;
	private JFileChooser PMCChooser;
	private ArrayList<Pair<Integer, Integer>> classification;
        private ArrayList<ArrayList<double[]>> ArrayKmeans;
        private JPanel controllerstat;
        private JButton KmeansCoucheSuivante;
        private JButton KmeansCouchePrecedente;
        private JButton permuterBut;
        private int kmeansCouCourant=0;
         private ArrayList<ArrayList<double[]>> kmeans;
        private JLabel statlabinfo;
        private String permutname="kmeans";
        private int[] tabNbNeur;
        private ArrayList<double[]> arrayHistoKmeans;
        private gestModele modele;
        private gestControler cont;
        private ArrayList<ArrayList<Integer>> kmeansClust;
        private JCheckBox CurricBox;
        private JLabel CurricBoxLab;
    private JTextField nbIterationInit;
    private JTextField nbExemplesTest;
    private JLabel nbExemplesLabTest;
    private JLabel nbIterationInitLab;
    private JLabel CurricBoxLab2;
     private JCheckBox CurricBox2;
    private JLabel jlabtaux;
    private JTextField jfieldtaux;
    private double taux;
	private JTextField nbIterationMax;
	private JLabel nbIterationMaxLab;
	private JTextField pasInput;
	private JLabel pasInputLab;
    private JTextField nbExempleApp;
    private JLabel nbExempleAppLab;
    private JTextField nbIterationCurric;
    private JLabel nbIterationCurricLab;
	/**
	 * Constructeur de la Fenetre principale.
	 */
	public Fenetre(){
		super();
                this.cont= new gestControler(this);
                this.modele=new gestModele();
		build();
	}

	/**
	 * M�thode qui construit la fenetre.
	 */
	private void build(){
		 setTitle("Réseaux de neurones Profonds"); // titre de la fenetre principale
		 setSize(1024,650); // Taille fenetre principale
		 setLocationRelativeTo(null); //Centrage
		 setResizable(true); //Pas de redimensionnement
		 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		 
		 this.setLayout(new BorderLayout());
		 imEntree= new JPanel();
		 imEntree.setLayout(new GridLayout(1, 2));

		 chargeSparse=new JPanel();
		 nonchargeSparse=new JPanel();
		 bas=new JPanel();
		 haut=new JPanel();
                 middlebas=new JPanel();
                 middlebas.setLayout(new BorderLayout());

                 middlebasup=new JPanel();
                 middlebasup.setBorder(BorderFactory.createLineBorder(Color.black));
                 statlabinfo=new JLabel("Statistiques du PMC ci dessous");
                 middlebasup.add(statlabinfo);
                 middlebas.add(middlebasup,BorderLayout.NORTH);
                 controllerstat=new JPanel();
                 controllerstat.setLayout(new GridLayout(1,3));

		 statfree=new JPanel();
                 statfree.setLayout(new FlowLayout(FlowLayout.LEFT));
		 jlabentree=new JLabel("Exemple en entrée");
		 jlabsortie=new JLabel("Sortie du réseau de neurone");

		 jlabclassif=new JTextField();

		 entreeSortie=new JPanel();
		 entreeSortie.setLayout(new GridLayout(8,2));


		 panneauGauche=new JPanel();
		 panneauGauche.setLayout(new BorderLayout());
                 panneauGauche.setBorder(BorderFactory.createLineBorder(Color.black));

		 haut.setLayout(new BorderLayout());
		 milieu=new JPanel();


		 haut.setBorder(BorderFactory.createLineBorder(Color.black));
		 haut.setPreferredSize(new Dimension(this.getWidth(),this.getHeight()/2-25));
		 bas.setBorder(BorderFactory.createLineBorder(Color.black));
		 bas.setLayout(new BorderLayout());
		 initPanneauControl();
		 //

		 milieu.setLayout(new BorderLayout());
		 milieu.setBorder(BorderFactory.createLineBorder(Color.black));
                 milieu.setPreferredSize(new Dimension(this.getWidth(),30));
		 //milieu.setPreferredSize(new Dimension(this.getWidth(),45));
		 initsparseBox();
                 
		 bas.setPreferredSize(new Dimension(this.getWidth(),this.getHeight()/2+50));
		 champsnbcouches=new JPanel();
		 initChargementNonSparse();
		 initChargementSparse();
		 nonchargeSparse.setPreferredSize(new Dimension(this.getWidth()-100,45));
		 milieu.add(nonchargeSparse,BorderLayout.EAST);

                 bas.add(middlebas,BorderLayout.CENTER);
		 param=new JPanel();
		 param.setLayout(new BorderLayout());

		 initFieldNbCouches();
                 
		 this.add(milieu,BorderLayout.NORTH);
		 this.add(bas,BorderLayout.SOUTH);
		 this.add(haut,BorderLayout.CENTER);
                 
		 

		 //buildMenuBar();
		 param.setBorder(BorderFactory.createLineBorder(Color.black));
		 panneauControl.setBorder(BorderFactory.createLineBorder(Color.black));

		 param.setPreferredSize(new Dimension((this.getWidth()/4)-10,this.getHeight()/2));
		 imgEntree = new JTextField("");
		 panneauGauche.add(imEntree,BorderLayout.NORTH);
		 entreeSortie.add(jlabentree);
		 entreeSortie.add(imgEntree);

		 entreeSortie.add(jlabsortie);

		 entreeSortie.add(jlabclassif);

                 jlabtaux=new JLabel("Taux de réussite Test");
                 jfieldtaux= new JTextField("");
                 entreeSortie.add(jlabtaux);
                 entreeSortie.add(jfieldtaux);
		 initAutEnco();
		 initSave();
		 initTrain();
		 initPMCBox();
                 initCurricBox();
		 panneauGauche.add(entreeSortie,BorderLayout.NORTH);
		 panneauGauche.add(panneauControl,BorderLayout.SOUTH);
		 bas.add(panneauGauche,BorderLayout.WEST);
		 bas.add(param,BorderLayout.EAST);


		 /**
            split = new JSplitPane(JSplitPane.VERTICAL_SPLIT,haut,changeIT);
            split.setDividerSize(4);
            reste.add(split);
		  **/

		 //add(reste);
		 setVisible(true);


	 }
         /**
          * Méthode qui initialise le panneau de contrôle
          */
	public void initPanneauControl(){
		panneauControl=new JPanel();
		panneauControl.setLayout(new GridLayout(4,2));

		this.iteprecedante=new JButton("Precedent i");
		iteprecedante.setActionCommand("Precedent i");
		iteprecedante.addActionListener(cont);

		this.itesuivante=new JButton("Suivant i");
		itesuivante.setActionCommand("Suivant i");
		itesuivante.addActionListener(cont);


		panneauControl.add(iteprecedante);
		panneauControl.add(itesuivante);

		this.exemplesuivant=new JButton("Suivant e");
		exemplesuivant.setActionCommand("Suivant e");
		exemplesuivant.addActionListener(cont);

		this.exempleprecedent=new JButton("Precedent e");
		exempleprecedent.setActionCommand("Precedent e");
		exempleprecedent.addActionListener(cont);


		panneauControl.add(exempleprecedent);
		panneauControl.add(exemplesuivant);

		play = new JButton("Lancer");
		play.setActionCommand("lancer");
		play.addActionListener(cont);

		panneauControl.add(play);

		cancel = new JButton("Arreter");
		cancel.setActionCommand("arreter");
		cancel.addActionListener(cont);

		panneauControl.add(cancel);

		genererExp = new JButton("genererExp");
		genererExp.setActionCommand("genererExp");
		genererExp.addActionListener(cont);

		panneauControl.add(genererExp);

		genererData=new JButton("genererData");
		genererData.setActionCommand("genererData");
		genererData.addActionListener(cont);

		panneauControl.add(genererData);


	}
        /**
         * Méthode initialisant la checkbox Sparse?
         */
	public void initsparseBox(){
		sparse=new JCheckBox();
		SparseLab=new JLabel("Sparse?");


		sparse.setActionCommand("sparseBox");

		sparse.addActionListener(cont);
		sparsePan=new JPanel();

		sparsePan.add(SparseLab);
		sparsePan.add(sparse);
		milieu.add(sparsePan,BorderLayout.WEST);
	}
        /**
         * Méthode initialisant la checkbox pour savoir si l'on veut une expérience curriculum
         */
        public void initCurricBox(){
		CurricBox=new JCheckBox();
		CurricBoxLab=new JLabel("Curriculum learning?");
                CurricBox=new JCheckBox();
                CurricBox.setActionCommand("Curric");

		CurricBox.addActionListener(cont);
		entreeSortie.add(CurricBoxLab);
		entreeSortie.add(CurricBox);


	}

        /**
         * Méthode qui initialise la checkbox pour savoir si l'on veut charger un PMC
         */
	public void initPMCBox(){
		PMCBox=new JCheckBox();
		PMCBoxLab=new JLabel("Charger PMC?");

		PMCBox.setActionCommand("PMCBox");

		PMCBox.addActionListener(cont);
		entreeSortie.add(PMCBoxLab);
		entreeSortie.add(PMCBox);


	}

        /**
         * Méthode qui initialise la checkbox pour savoir si l'on veut préentrainer le réseau avec un auto encodeur
         */
	public void initAutEnco(){
		autoEncodeBox=new JCheckBox();
		autoEncodeBoxLab=new JLabel("Auto Encodeur?");
		autoEncodeBox.setActionCommand("AutoEncode");
		autoEncodeBox.addActionListener(cont);
		entreeSortie.add(autoEncodeBoxLab);
		entreeSortie.add(autoEncodeBox);
	}

        /**
         * Méthode qui initialise la checkbox pour savoir si l'on veut sauvegarder le pmc.
         */
	public void initSave(){
		saveBox=new JCheckBox();
		saveBoxLab=new JLabel("Enregistrer NN?");
		saveBox.setActionCommand("saveNN");
		saveBox.addActionListener(cont);
		entreeSortie.add(saveBoxLab);
		entreeSortie.add(saveBox);
	}

        /**
         * Méthode qui initialise la checkbox déterminant le code d'apprentissage
         */
	public void initTrain(){
		trainBox=new JCheckBox();
		trainBoxLab=new JLabel("Train type for?");
		trainBox.setActionCommand("traintype");
		trainBox.addActionListener(cont);
		entreeSortie.add(trainBoxLab);
		entreeSortie.add(trainBox);
	}

        /**
         * Méthode qui initialise la barre de chargement de donnée sparse
         */
	public void initChargementSparse(){


		chargeSparse.setLayout(new GridLayout());
		sparseApp=new JPanel();
		sparseApp.setLayout(new BorderLayout());

		sparseTest=new JPanel();
		sparseTest.setLayout(new BorderLayout());

		sparseChooserBoutonApp=new JButton("Ouvrir");
		sparseChooserBoutonApp.setActionCommand("boutonXApp");
		sparseChooserBoutonApp.addActionListener(cont);

		sparseChooserLabApp=new JLabel("Xapp");
		sparseChooserFieldApp=new JTextField(chemainFichierXApp);
		sparseChooserFieldApp.setPreferredSize(new Dimension(40,30));
		sparseApp.add(sparseChooserLabApp,BorderLayout.WEST);
		sparseApp.add(sparseChooserFieldApp,BorderLayout.CENTER);
		sparseApp.add(sparseChooserBoutonApp,BorderLayout.EAST);


		chargeSparse.add(sparseApp);

		sparseChooserBoutonTest=new JButton("Ouvrir");
		sparseChooserBoutonTest.setActionCommand("boutonXTest");
		sparseChooserBoutonTest.addActionListener(cont);

		sparseChooserLabTest=new JLabel("Xtest");
		sparseChooserFieldTest=new JTextField(chemainFichierXApp);
		sparseChooserFieldTest.setPreferredSize(new Dimension(40,30));
		sparseTest.add(sparseChooserLabTest,BorderLayout.WEST);
		sparseTest.add(sparseChooserFieldTest,BorderLayout.CENTER);
		sparseTest.add(sparseChooserBoutonTest,BorderLayout.EAST);
		chargeSparse.setPreferredSize(new Dimension(this.getWidth()-100,45));
		chargeSparse.add(sparseTest);

		//milieu.add(chargeSparse);


	}


        /**
         * Méthode qui initialise la barre de chargement de données non sparse
         */
	public void initChargementNonSparse(){
		nonchargeSparse=new JPanel();
		nonchargeSparse.setLayout(new GridLayout());
		nonsparseApp=new JPanel();
		nonsparseApp.setLayout(new BorderLayout());
		nonsparseTest=new JPanel();
		nonsparseTest.setLayout(new BorderLayout());
		nonsparseAppY=new JPanel();
		nonsparseAppY.setLayout(new BorderLayout());
		nonsparseTestY=new JPanel();
		nonsparseTestY.setLayout(new BorderLayout());

		nonsparseChooserBoutonApp=new JButton("Ouvrir");
		nonsparseChooserBoutonApp.setActionCommand("boutonXAppns");
		nonsparseChooserBoutonApp.addActionListener(cont);

		nonsparseChooserBoutonAppY=new JButton("Ouvrir");
		nonsparseChooserBoutonAppY.setActionCommand("boutonYAppns");
		nonsparseChooserBoutonAppY.addActionListener(cont);

		nonsparseChooserLabApp=new JLabel("Xapp");
		nonsparseChooserFieldApp=new JTextField(chemainFichierXApp);
		nonsparseChooserFieldApp.setPreferredSize(new Dimension(40,30));
		nonsparseApp.add(nonsparseChooserLabApp,BorderLayout.WEST);
		nonsparseApp.add(nonsparseChooserFieldApp,BorderLayout.CENTER);
		nonsparseApp.add(nonsparseChooserBoutonApp,BorderLayout.EAST);

		nonsparseChooserLabAppY=new JLabel("Yapp");
		nonsparseChooserFieldAppY=new JTextField(chemainFichierYApp);
		nonsparseChooserFieldAppY.setPreferredSize(new Dimension(40,30));

		nonsparseAppY.add(nonsparseChooserLabAppY,BorderLayout.WEST);
		nonsparseAppY.add(nonsparseChooserFieldAppY,BorderLayout.CENTER);
		nonsparseAppY.add(nonsparseChooserBoutonAppY,BorderLayout.EAST);


		nonsparseChooserBoutonTest=new JButton("Ouvrir");
		nonsparseChooserBoutonTest.setActionCommand("boutonXTestns");
		nonsparseChooserBoutonTest.addActionListener(cont);

		nonsparseChooserLabTest=new JLabel("Xtest");
		nonsparseChooserFieldTest=new JTextField(chemainFichierXTest);
		nonsparseChooserFieldTest.setPreferredSize(new Dimension(40,30));
		nonsparseTest.add(nonsparseChooserLabTest,BorderLayout.WEST);
		nonsparseTest.add(nonsparseChooserFieldTest,BorderLayout.CENTER);
		nonsparseTest.add(nonsparseChooserBoutonTest,BorderLayout.EAST);

		nonsparseChooserBoutonTestY=new JButton("Ouvrir");
		nonsparseChooserBoutonTestY.setActionCommand("boutonYTestns");
		nonsparseChooserBoutonTestY.addActionListener(cont);

		nonsparseChooserLabTestY=new JLabel("Ytest");
		nonsparseChooserFieldTestY=new JTextField(chemainFichierYTest);
		nonsparseChooserFieldTestY.setPreferredSize(new Dimension(40,30));
		nonsparseTestY.add(nonsparseChooserLabTestY,BorderLayout.WEST);
		nonsparseTestY.add(nonsparseChooserFieldTestY,BorderLayout.CENTER);
		nonsparseTestY.add(nonsparseChooserBoutonTestY,BorderLayout.EAST);

		nonchargeSparse.add(nonsparseApp);
		nonchargeSparse.add(nonsparseAppY);
		nonchargeSparse.add(nonsparseTest);
		nonchargeSparse.add(nonsparseTestY);
		//milieu.add(nonchargeSparse);
	}


	/**
	 * Méthode qui permet d'inialiser le panneau d'affichage des couches
	 */
	public void initPanneauCouches(){
		activations=modele.getAllActiv(nomExp);
		couches = new Cachees(activations,iterationActuel,exempleActuel,haut.getWidth(),haut.getHeight());
                classification=modele.getResultat(nomExp);
		nbExempleMax=activations.size();
		couches.setPreferredSize(new Dimension(this.getWidth()+10000,haut.getHeight()-20));
		couchesScrollBar=new JScrollPane(couches,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		couchesScrollBar.setPreferredSize(new Dimension(this.getWidth(),this.haut.getHeight()));
		couchesScrollBar.setBorder(BorderFactory.createLineBorder(Color.black));

		haut.add(couchesScrollBar);
	}

        /**
         * Méthode qui met à jour le panneau statistiques avec le tableau passé en paramètre
         * @param listeStatCouches: le tableau contenant l'histogramme
         */
	public void majpanneauStat(ArrayList<int[]> listeStatCouches){
		for(int i=0;i<listeStatCouches.size();i++){
			statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth(),bas.getHeight()-60,"Statistique Couche "+i,listeStatCouches.get(i)));

		}

		statfree.updateUI();
	}

        /**
         * Méthode qui initialise le panneau d'affichage de statistiques avec un tableau contenant l'histogramme
         * @param listeStatCouches tableau contenant les histogrammes, 1 par couche
         */
	public void initpanneauHisto(ArrayList<int[]> listeStatCouches){

		 for(int i=0;i<listeStatCouches.size();i++){
			 statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth()+50,bas.getHeight()-80,"Statistique Couche "+i,listeStatCouches.get(i)));

		 }
		 statfreeScrollBar=new JScrollPane(statfree,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		 statfreeScrollBar.setPreferredSize(new Dimension(10000,bas.getHeight()-30));
		 statfreeScrollBar.setBorder(BorderFactory.createLineBorder(Color.black));
		 
                 middlebas.add(statfreeScrollBar,BorderLayout.CENTER);

                permuterBut= new JButton("Changer Type Stat");
                permuterBut.setActionCommand("Permut stat");
                permuterBut.addActionListener(cont);
                controllerstat.add(permuterBut);
                middlebas.add(controllerstat,BorderLayout.SOUTH);

	 }
         /**
          * Cette méthode va initialiser le panneau qui affiche le pourcentage de neurone dans chaque cluster pour la couche i
          * @param listeStatKmeans tableau contenant l'histogramme avec le pourcentage des neurones daans chaque cluster
          * @param couchi numero de la couche pour l'affichage
          */
        public void initpanneauKmeans(ArrayList<double[]> listeStatKmeans,int couchi){
                for(int i=0;i<listeStatKmeans.size();i++){
			 statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth()+50,bas.getHeight()-80,"Couche "+(i+1),"kmeans",listeStatKmeans.get(i)));
		}
                statfreeScrollBar=new JScrollPane(statfree,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		statfreeScrollBar.setPreferredSize(new Dimension(10000,bas.getHeight()-30));
		statfreeScrollBar.setBorder(BorderFactory.createLineBorder(Color.black));
		
		middlebas.add(statfreeScrollBar,BorderLayout.CENTER);
                
                KmeansCoucheSuivante= new JButton("Couche suivante");
                KmeansCoucheSuivante.setActionCommand("Kmeans suivante");
                KmeansCoucheSuivante.addActionListener(cont);
                KmeansCouchePrecedente= new JButton("Couche precedente");
                KmeansCouchePrecedente.setActionCommand("Kmeans precedente");
                KmeansCouchePrecedente.addActionListener(cont);
                permuterBut= new JButton("Changer Type Stat");
                permuterBut.setActionCommand("Permut stat");
                permuterBut.addActionListener(cont);
                controllerstat.add(KmeansCouchePrecedente);
                controllerstat.add(permuterBut);
                controllerstat.add(KmeansCoucheSuivante);
                middlebas.add(controllerstat,BorderLayout.SOUTH);


         }




         /**
          * Méthode qui change l'affichage des statistiques
          * @param type le type de statistiques à afficher
          */
         public void permuter(String type){
                if(type.equals("kmeans")){
                    statfree.removeAll();
                    middlebas.removeAll();
                    controllerstat.removeAll();
                    initpanneauKmeans(arrayHistoKmeans, kmeansCouCourant+1);
                    middlebasup.add(statlabinfo);
                    middlebas.add(middlebasup,BorderLayout.NORTH);
                    statlabinfo.setText("Kmeans pourcentage clustering couche "+ (kmeansCouCourant+1));
                    
                    statfree.updateUI();
                    statlabinfo.updateUI();
                    middlebasup.updateUI();
                    middlebas.updateUI();
                    controllerstat.updateUI();
                }
                else if(type.equals("distribution")){
                    statfree.removeAll();
                    middlebas.removeAll();
                    controllerstat.removeAll();
                    initpanneauCourbeKmeans();
                    middlebasup.add(statlabinfo);
                    middlebas.add(middlebasup,BorderLayout.NORTH);
                    statlabinfo.setText("Distribution representant cluster Couche "+ (kmeansCouCourant+1));

                    statfree.updateUI();
                    statlabinfo.updateUI();
                    middlebasup.updateUI();
                    middlebas.updateUI();
                    controllerstat.updateUI();
                }
                else{
                    statfree.removeAll();
                    middlebas.removeAll();
                    controllerstat.removeAll();
                    initpanneauCourbe();
                    middlebasup.add(statlabinfo);
                    middlebas.add(middlebasup,BorderLayout.NORTH);
                    statlabinfo.setText("Erreur Quadratique");
                    statlabinfo.updateUI();
                    controllerstat.updateUI();
                    middlebasup.updateUI();
                    middlebas.updateUI();
                    statfree.updateUI();
                }
         }

        /**
         * Met a jour le panneau d'affichage des représentants des cluster de K-Means
         * @param listeStatKmeans la liste des courbes à afficher
         */
        public void majpanneauKmeans(ArrayList<Integer[]> listeStatKmeans){
		 for(int i=0;i<listeStatKmeans.size();i++){
                        statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth()+50,bas.getHeight()-80,"Cluster "+i,"Pourcentage de neurones dans chaque cluster",kmeans.get(kmeansCouCourant).get(i)));
		 }
		 statfree.updateUI();
	 }

         /**
          *
          */
         public void initTabNbNeur(){
                tabNbNeur=new int[nbCouches];
                for(int i=0;i<nbCouches;i++){
                    tabNbNeur[i]=activations.get(0).get(0).get(i).length;
                }
                
         }

         /**
          * Méthode qui récupère les données sur l'appartenance d'un neuronne au cluster kmeans et fait appel au calcul de pourcentage du modèle
          */
         public void calculKmeans(){
                 kmeans=modele.getKmeans(nbCouches);
                 kmeansClust=modele.readAllCluster(nbCouches);
                 arrayHistoKmeans=modele.pourcentageNeuKmeans(kmeansClust,tabNbNeur,5);
	 }

         /**
          * Méthode qui récupère le taux de classification et l'affiche. récupère aussi l'erreur quadratique du modele
          */
	public void calculStat(){
                taux=modele.getTaux(nomExp);
                jfieldtaux.setText(taux+"");
		ArrayErreur=modele.getErreur(nomExp);
	}


        /**
         * Initialise le panneau contenant la courbe de l'errur quadratique
         */
	public void initpanneauCourbe(){
		statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth(),bas.getHeight()-80,"ERREUR quadratique ",false,ArrayErreur));
                controllerstat.add(permuterBut);
                middlebas.add(controllerstat,BorderLayout.SOUTH);
                middlebas.add(statfree,BorderLayout.CENTER);
        }


        /**
         * Initialise le panneau contenant la courbe de l'erreur curriculum
         *
         */
	public void initpanneauCourbeCurric(){
            ArrayList<Pair<Integer, Double>> erreurAvec=modele.getCurric("erreurAvec.txt");
            ArrayList<Pair<Integer, Double>> erreurSans=modele.getCurric("erreurSans.txt");

                statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth(),bas.getHeight()-80,"Erreur Moyenne sans Curric",erreurSans,"curric"));
                statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth(),bas.getHeight()-80,"Erreur Moyenne avec Curric",erreurAvec,"curric"));
                statfreeScrollBar=new JScrollPane(statfree,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		statfreeScrollBar.setPreferredSize(new Dimension(10000,bas.getHeight()-30));
		statfreeScrollBar.setBorder(BorderFactory.createLineBorder(Color.black));


		middlebas.add(statfreeScrollBar,BorderLayout.CENTER);
                statfree.updateUI();
                middlebas.updateUI();
                statfreeScrollBar.updateUI();

        }

        /**
         * Met à jour le panneau contenant les courbes de distribution de représentant des clusters
         */
       public void majpanneauCourbeKmeans(){
                for(int i=0;i<kmeans.get(0).size();i++){
			 statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth(),bas.getHeight()-80,"Distribution sur cluster "+ (i+1),false,true,kmeans.get(kmeansCouCourant).get(i)));
                }
                statfree.updateUI();
        }


        /**
                  * Initialise jour le panneau contenant les courbes de distribution de représentant des clusters

         */
        public  void initpanneauCourbeKmeans(){
		for(int i=0;i<kmeans.get(0).size();i++){
			 statfree.add(new Stats(bas.getWidth()-panneauGauche.getWidth()-panneauControl.getWidth(),bas.getHeight()-80,"Distribution sur cluster "+ (i+1),false,true,kmeans.get(kmeansCouCourant).get(i)));
                }
                statfreeScrollBar=new JScrollPane(statfree,JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		statfreeScrollBar.setPreferredSize(new Dimension(10000,bas.getHeight()-30));
		statfreeScrollBar.setBorder(BorderFactory.createLineBorder(Color.black));
		
		middlebas.add(statfreeScrollBar,BorderLayout.CENTER);

                KmeansCoucheSuivante= new JButton("Couche suivante");
                KmeansCoucheSuivante.setActionCommand("Kmeans suivante");
                KmeansCoucheSuivante.addActionListener(cont);
                KmeansCouchePrecedente= new JButton("Couche precedente");
                KmeansCouchePrecedente.setActionCommand("Kmeans precedente");
                KmeansCouchePrecedente.addActionListener(cont);
                permuterBut= new JButton("Changer Type Stat");
                permuterBut.setActionCommand("Permut stat");
                permuterBut.addActionListener(cont);
                controllerstat.add(KmeansCouchePrecedente);
                controllerstat.add(permuterBut);
                controllerstat.add(KmeansCoucheSuivante);
                middlebas.add(controllerstat,BorderLayout.SOUTH);
        }
	
	/**
	 * Initialise de menu contenant les champs  du nom de l'experience, le learning rate, le nombre de couches
	 */

	public void initFieldNbCouches(){
		nomExperience= new JTextField("");
		nomExperienceLab=new JLabel("Experience");
		nomExperience.setActionCommand("Experience");
		nomExperience.addActionListener(cont);

		learningRate=new JTextField("");
		learningRatelab=new JLabel("LearningRate");
		learningRate.setActionCommand("learningRate");
		learningRate.addActionListener(cont);

		champsnbcouches.setLayout(new GridLayout(3,2));

		nbCouchesJTF= new JTextField("");
		nbCouchesLab=new JLabel("NbCouches");
		nbCouchesJTF.setActionCommand("NbCouches");
		nbCouchesJTF.addActionListener(cont);


		champsnbcouches.add(nomExperienceLab);
		champsnbcouches.add(nomExperience);
		champsnbcouches.add(learningRatelab);
		champsnbcouches.add(learningRate);
		champsnbcouches.add(nbCouchesLab);
		champsnbcouches.add(nbCouchesJTF);

		param.add(champsnbcouches,BorderLayout.NORTH);
	}

        /**
         * Initialise le menu contenant les informations à compléter pour créer une expérience de curriculum learning.
         */
       
        public void initFieldCurric(){

		nomExperience= new JTextField("");
		nomExperienceLab=new JLabel("Experience");
		nomExperience.setActionCommand("Experience");
		nomExperience.addActionListener(cont);

		nbExempleApp=new JTextField("");
		nbExempleAppLab=new JLabel("nbApp");
		nbExempleApp.setActionCommand("nbApp");
		nbExempleApp.addActionListener(cont);

		nbExemplesTest=new JTextField("");
		nbExemplesLabTest=new JLabel("nbTest");
		nbExemplesTest.setActionCommand("nbTest");
		nbExemplesTest.addActionListener(cont);

                nbIterationInit=new JTextField("");
		nbIterationInitLab=new JLabel("Nbinput Init");
		nbIterationInit.setActionCommand("nbIteInit");
		nbIterationInit.addActionListener(cont);
		
		nbIterationMax=new JTextField("");
		nbIterationMaxLab=new JLabel("Nbinput Max");
		nbIterationMax.setActionCommand("nbInputMax");
		nbIterationMax.addActionListener(cont);
		
		pasInput=new JTextField("");
		pasInputLab=new JLabel("Pas Input");
		pasInput.setActionCommand("nbInput");
		pasInput.addActionListener(cont);
		
                nbIterationCurric=new JTextField("");
                nbIterationCurricLab=new JLabel("Nb Iteration");
		nbIterationCurric.setActionCommand("nbIte");
		nbIterationCurric.addActionListener(cont);

		learningRate = new JTextField("");
		learningRatelab = new JLabel("Learning Rate");
		learningRate.setActionCommand("learningRate");
		learningRate.addActionListener(cont);
		
		
		/*
		@param nomFic nom du fichier expèrience
        * @param learningRate epsilon pour la descente de gradient de l'apprentissage
        * @param save  booleen pour indiquer si l'on veut sauvegarder ou pas le PMC
        * @param curric booleen pour indiquer si l'on veut experience avec un comparatif de l'apprentissage avec curric ou pas.
        * @param nbIterations nombre d'iterations d'apprentissage
        * @param nbApprentissage le nombre d'exemple donnes en apprentissage
        * @param nbTest le nombre d'exemple donnes en test
        * @param nbInputsInit le nombre d'entrees pour chaque exemple, premiere valeur testee         
        * @param nbInputsMax le nombre d'entrees pour chaque exemple, valeur maximum testee
        * @param pasInput le pas entre chaque valeur d'input testee
                */
		champschargePMC=new JPanel();
		champschargePMC.setLayout(new GridLayout(8,2));

		champschargePMC.add(nomExperienceLab);
		champschargePMC.add(nomExperience);

                champschargePMC.add(nbExempleAppLab);
                champschargePMC.add(nbExempleApp);
               
		champschargePMC.add(nbExemplesLabTest);
		champschargePMC.add(nbExemplesTest);

		champschargePMC.add(learningRatelab);
		champschargePMC.add(learningRate);

		champschargePMC.add(nbIterationInitLab);
		champschargePMC.add(nbIterationInit);
             
                champschargePMC.add(nbIterationMaxLab);
		champschargePMC.add(nbIterationMax);

                champschargePMC.add(nbIterationCurricLab);
		champschargePMC.add(nbIterationCurric);


                champschargePMC.add(pasInputLab);
                champschargePMC.add(pasInput);
	

		param.add(champschargePMC,BorderLayout.NORTH);
	}
        /**
         * Initialise le menu permettant de créer une expérience avec chargement de PMC enregistré
         */
	public void initFieldChargePMC(){

		nomExperience= new JTextField("");
		nomExperienceLab=new JLabel("Experience");
		nomExperience.setActionCommand("Experience");
		nomExperience.addActionListener(cont);

		nomPMCLab=new JLabel("Nom PMC");
		nomPMCField=new JTextField("");
		nomPMCField.setActionCommand("NomPMC");
		nomPMCField.addActionListener(cont);


		PMCChoose=new JButton("Ouvrir");
		PMCChoose.setActionCommand("Ouvrir PMC");
		PMCChoose.addActionListener(cont);

		nbInput=new JTextField("");
		nbInputLab=new JLabel("nbInput");
		nbInput.setActionCommand("nbInput");
		nbInput.addActionListener(cont);

		nbSortie=new JTextField("");
		nbSortieLab=new JLabel("nbOutput");
		nbSortie.setActionCommand("nbOutput");
		nbSortie.addActionListener(cont);

		learningRate = new JTextField("0.01");
		learningRatelab = new JLabel("Learning Rate");
		learningRate.setActionCommand("learningRate");
		learningRate.addActionListener(cont);

		champschargePMC=new JPanel();
		champschargePMC.setLayout(new GridLayout(6,2));

		champschargePMC.add(nomExperienceLab);
		champschargePMC.add(nomExperience);

		champschargePMC.add(nbInputLab);
		champschargePMC.add(nbInput);

		champschargePMC.add(nbSortieLab);
		champschargePMC.add(nbSortie);

		champschargePMC.add(learningRatelab);
		champschargePMC.add(learningRate);

		champschargePMC.add(nomPMCLab);
		champschargePMC.add(nomPMCField);

		champschargePMC.add(PMCChoose);




		param.add(champschargePMC,BorderLayout.NORTH);
	}

/**
 * initialise le panneau contenant les champs à remplir pour le nombre d'entree, le nombre de sorties ainsi que le nombre de neurones par couches
 * @param nbCouches le nombres de couches du PMC
 */
	public void initListeCouches(int nbCouches){

		champs.setLayout(new GridLayout(nbCouches+2,2));
		police = new Font("Arial", Font.BOLD, 12);
		String text1;
		String text2;
		jtf = new ArrayList<JTextField>();
		label = new ArrayList<JLabel>();

		nbInput=new JTextField("");
		nbInputLab=new JLabel("nbInput");
		nbInput.setActionCommand("nbInput");
		nbInput.addActionListener(cont);

		nbSortie=new JTextField("");
		nbSortieLab=new JLabel("nbOutput");
		nbSortie.setActionCommand("nbOutput");
		nbSortie.addActionListener(cont);
		champs.add(nbInputLab);
		champs.add(nbInput);

		for(int i = 0; i < nbCouches ; i++){
			text1 = "";
			text2 = "Couche "+i+":";

			label.add(new JLabel(text2));
			jtf.add(new JTextField(text1));
			label.get(i).setFont(police);
			champs.add(label.get(i));
			champs.add(jtf.get(i));
		}
		champs.add(nbSortieLab);
		champs.add(nbSortie);
		param.add(champs,BorderLayout.SOUTH);
	}


	/**
	 * M�thode de gestion des �v�nements.
	 */
	

    public ArrayList<Double> getArrayErreur() {
        return ArrayErreur;
    }

    public void setArrayErreur(ArrayList<Double> ArrayErreur) {
        this.ArrayErreur = ArrayErreur;
    }

    public ArrayList<ArrayList<double[]>> getArrayKmeans() {
        return ArrayKmeans;
    }

    public void setArrayKmeans(ArrayList<ArrayList<double[]>> ArrayKmeans) {
        this.ArrayKmeans = ArrayKmeans;
    }

    public ArrayList<ArrayList<ArrayList<int[]>>> getArrayStats() {
        return ArrayStats;
    }

    public void setArrayStats(ArrayList<ArrayList<ArrayList<int[]>>> ArrayStats) {
        this.ArrayStats = ArrayStats;
    }

    public int getHORIZONTAL() {
        return HORIZONTAL;
    }

    public void setHORIZONTAL(int HORIZONTAL) {
        this.HORIZONTAL = HORIZONTAL;
    }

    public JButton getKmeansCouchePrecedente() {
        return KmeansCouchePrecedente;
    }

    public void setKmeansCouchePrecedente(JButton KmeansCouchePrecedente) {
        this.KmeansCouchePrecedente = KmeansCouchePrecedente;
    }

    public JButton getKmeansCoucheSuivante() {
        return KmeansCoucheSuivante;
    }

    public void setKmeansCoucheSuivante(JButton KmeansCoucheSuivante) {
        this.KmeansCoucheSuivante = KmeansCoucheSuivante;
    }

    public JCheckBox getPMCBox() {
        return PMCBox;
    }

    public void setPMCBox(JCheckBox PMCBox) {
        this.PMCBox = PMCBox;
    }

    public JLabel getPMCBoxLab() {
        return PMCBoxLab;
    }

    public void setPMCBoxLab(JLabel PMCBoxLab) {
        this.PMCBoxLab = PMCBoxLab;
    }

    public JButton getPMCChoose() {
        return PMCChoose;
    }

    public void setPMCChoose(JButton PMCChoose) {
        this.PMCChoose = PMCChoose;
    }

    public JFileChooser getPMCChooser() {
        return PMCChooser;
    }

    public ArrayList<ArrayList<Integer>> getKmeansClust() {
        return kmeansClust;
    }

    public void setKmeansClust(ArrayList<ArrayList<Integer>> kmeansClust) {
        this.kmeansClust = kmeansClust;
    }

    public void setPMCChooser(JFileChooser PMCChooser) {
        this.PMCChooser = PMCChooser;
    }

    public JLabel getSparseLab() {
        return SparseLab;
    }

    public void setSparseLab(JLabel SparseLab) {
        this.SparseLab = SparseLab;
    }

    public ArrayList<ArrayList<ArrayList<double[]>>> getActivations() {
        return activations;
    }

    public void setActivations(ArrayList<ArrayList<ArrayList<double[]>>> activations) {
        this.activations = activations;
    }

    public boolean isAlterneStat() {
        return alterneStat;
    }

    public void setAlterneStat(boolean alterneStat) {
        this.alterneStat = alterneStat;
    }

    public ArrayList<double[]> getArrayHistoKmeans() {
        return arrayHistoKmeans;
    }

    public void setArrayHistoKmeans(ArrayList<double[]> arrayHistoKmeans) {
        this.arrayHistoKmeans = arrayHistoKmeans;
    }

    public boolean isAutoEncode() {
        return autoEncode;
    }

    public void setAutoEncode(boolean autoEncode) {
        this.autoEncode = autoEncode;
    }

    public JCheckBox getAutoEncodeBox() {
        return autoEncodeBox;
    }

    public void setAutoEncodeBox(JCheckBox autoEncodeBox) {
        this.autoEncodeBox = autoEncodeBox;
    }

    public JLabel getAutoEncodeBoxLab() {
        return autoEncodeBoxLab;
    }

    public void setAutoEncodeBoxLab(JLabel autoEncodeBoxLab) {
        this.autoEncodeBoxLab = autoEncodeBoxLab;
    }

    public JPanel getBas() {
        return bas;
    }

    public void setBas(JPanel bas) {
        this.bas = bas;
    }

    public JButton getCancel() {
        return cancel;
    }

    public void setCancel(JButton cancel) {
        this.cancel = cancel;
    }

    public JPanel getChamps() {
        return champs;
    }

    public void setChamps(JPanel champs) {
        this.champs = champs;
    }

    public JPanel getChampschargePMC() {
        return champschargePMC;
    }

    public void setChampschargePMC(JPanel champschargePMC) {
        this.champschargePMC = champschargePMC;
    }

    public JPanel getChampsnbcouches() {
        return champsnbcouches;
    }

    public void setChampsnbcouches(JPanel champsnbcouches) {
        this.champsnbcouches = champsnbcouches;
    }

    public JPanel getChargeSparse() {
        return chargeSparse;
    }

    public void setChargeSparse(JPanel chargeSparse) {
        this.chargeSparse = chargeSparse;
    }

    public JMenuItem getCharger() {
        return charger;
    }

    public void setCharger(JMenuItem charger) {
        this.charger = charger;
    }

    public String getChemainFichierXApp() {
        return chemainFichierXApp;
    }

    public void setChemainFichierXApp(String chemainFichierXApp) {
        this.chemainFichierXApp = chemainFichierXApp;
    }

    public String getChemainFichierXTest() {
        return chemainFichierXTest;
    }

    public void setChemainFichierXTest(String chemainFichierXTest) {
        this.chemainFichierXTest = chemainFichierXTest;
    }

    public String getChemainFichierYApp() {
        return chemainFichierYApp;
    }

    public void setChemainFichierYApp(String chemainFichierYApp) {
        this.chemainFichierYApp = chemainFichierYApp;
    }

    public String getChemainFichierYTest() {
        return chemainFichierYTest;
    }

    public void setChemainFichierYTest(String chemainFichierYTest) {
        this.chemainFichierYTest = chemainFichierYTest;
    }

    public String getCheminFichierPMC() {
        return cheminFichierPMC;
    }

    public void setCheminFichierPMC(String cheminFichierPMC) {
        this.cheminFichierPMC = cheminFichierPMC;
    }


    public ArrayList<Pair<Integer, Integer>> getClassification() {
        return classification;
    }

    public void setClassification(ArrayList<Pair<Integer, Integer>> classification) {
        this.classification = classification;
    }

    public gestControler getContr() {
        return contr;
    }

    public void setContr(gestControler contr) {
        this.contr = contr;
    }

    public JPanel getControllerstat() {
        return controllerstat;
    }

    public void setControllerstat(JPanel controllerstat) {
        this.controllerstat = controllerstat;
    }

    public Cachees getCouches() {
        return couches;
    }

    public void setCouches(Cachees couches) {
        this.couches = couches;
    }

    public JScrollPane getCouchesScrollBar() {
        return couchesScrollBar;
    }

    public void setCouchesScrollBar(JScrollPane couchesScrollBar) {
        this.couchesScrollBar = couchesScrollBar;
    }

    public JMenu getEdition() {
        return edition;
    }

    public void setEdition(JMenu edition) {
        this.edition = edition;
    }

    public String getEntree() {
        return entree;
    }

    public void setEntree(String entree) {
        this.entree = entree;
    }

    public JPanel getEntreeSortie() {
        return entreeSortie;
    }

    public void setEntreeSortie(JPanel entreeSortie) {
        this.entreeSortie = entreeSortie;
    }

    public double getEpsilon() {
        return epsilon;
    }

    public void setEpsilon(double epsilon) {
        this.epsilon = epsilon;
    }

    public int getExempleActuel() {
        return exempleActuel;
    }

    public void setExempleActuel(int exempleActuel) {
        this.exempleActuel = exempleActuel;
    }

    public JButton getExempleprecedent() {
        return exempleprecedent;
    }

    public void setExempleprecedent(JButton exempleprecedent) {
        this.exempleprecedent = exempleprecedent;
    }

    public JButton getExemplesuivant() {
        return exemplesuivant;
    }

    public void setExemplesuivant(JButton exemplesuivant) {
        this.exemplesuivant = exemplesuivant;
    }

    public JMenuItem getFermer() {
        return fermer;
    }

    public void setFermer(JMenuItem fermer) {
        this.fermer = fermer;
    }

    public JMenu getFichier() {
        return fichier;
    }

    public void setFichier(JMenu fichier) {
        this.fichier = fichier;
    }

    public JButton getGenererData() {
        return genererData;
    }

    public void setGenererData(JButton genererData) {
        this.genererData = genererData;
    }

    public JButton getGenererExp() {
        return genererExp;
    }

    public void setGenererExp(JButton genererExp) {
        this.genererExp = genererExp;
    }

    public JPanel getHaut() {
        return haut;
    }

    public void setHaut(JPanel haut) {
        this.haut = haut;
    }

    public JPanel getImEntree() {
        return imEntree;
    }

    public void setImEntree(JPanel imEntree) {
        this.imEntree = imEntree;
    }

    public JTextField getImgEntree() {
        return imgEntree;
    }

    public void setImgEntree(JTextField imgEntree) {
        this.imgEntree = imgEntree;
    }

    public JButton getIteprecedante() {
        return iteprecedante;
    }

    public void setIteprecedante(JButton iteprecedante) {
        this.iteprecedante = iteprecedante;
    }

    public int getIterationActuel() {
        return iterationActuel;
    }

    public void setIterationActuel(int iterationActuel) {
        this.iterationActuel = iterationActuel;
    }

    public JButton getItesuivante() {
        return itesuivante;
    }

    public void setItesuivante(JButton itesuivante) {
        this.itesuivante = itesuivante;
    }

    public JTextField getJlabclassif() {
        return jlabclassif;
    }

    public void setJlabclassif(JTextField jlabclassif) {
        this.jlabclassif = jlabclassif;
    }

    public JLabel getJlabentree() {
        return jlabentree;
    }

    public void setJlabentree(JLabel jlabentree) {
        this.jlabentree = jlabentree;
    }

    public JLabel getJlabsortie() {
        return jlabsortie;
    }

    public void setJlabsortie(JLabel jlabsortie) {
        this.jlabsortie = jlabsortie;
    }

    public ArrayList<JTextField> getJtf() {
        return jtf;
    }

    public void setJtf(ArrayList<JTextField> jtf) {
        this.jtf = jtf;
    }

    public ArrayList<ArrayList<double[]>> getKmeans() {
        return kmeans;
    }

    public void setKmeans(ArrayList<ArrayList<double[]>> kmeans) {
        this.kmeans = kmeans;
    }

    public int getKmeansCouCourant() {
        return kmeansCouCourant;
    }

    public void setKmeansCouCourant(int kmeansCouCourant) {
        this.kmeansCouCourant = kmeansCouCourant;
    }

    public ArrayList<JLabel> getLabel() {
        return label;
    }

    public void setLabel(ArrayList<JLabel> label) {
        this.label = label;
    }

    public JTextField getLearningRate() {
        return learningRate;
    }

    public void setLearningRate(JTextField learningRate) {
        this.learningRate = learningRate;
    }

    public JLabel getLearningRatelab() {
        return learningRatelab;
    }

    public void setLearningRatelab(JLabel learningRatelab) {
        this.learningRatelab = learningRatelab;
    }

    public ArrayList<Couche> getListePanCouches() {
        return listePanCouches;
    }

    public void setListePanCouches(ArrayList<Couche> listePanCouches) {
        this.listePanCouches = listePanCouches;
    }

    public ArrayList<String> getListe_chemin() {
        return liste_chemin;
    }

    public void setListe_chemin(ArrayList<String> liste_chemin) {
        this.liste_chemin = liste_chemin;
    }

    

    public void setMenuBar(JMenuBar menuBar) {
        this.menuBar = menuBar;
    }

    public JPanel getMiddlebas() {
        return middlebas;
    }

    public void setMiddlebas(JPanel middlebas) {
        this.middlebas = middlebas;
    }

    public JPanel getMiddlebasup() {
        return middlebasup;
    }

    public void setMiddlebasup(JPanel middlebasup) {
        this.middlebasup = middlebasup;
    }

    public JPanel getMilieu() {
        return milieu;
    }

    public void setMilieu(JPanel milieu) {
        this.milieu = milieu;
    }

    public int getNbCouches() {
        return nbCouches;
    }

    public void setNbCouches(int nbCouches) {
        this.nbCouches = nbCouches;
    }

    public JTextField getNbCouchesJTF() {
        return nbCouchesJTF;
    }

    public void setNbCouchesJTF(JTextField nbCouchesJTF) {
        this.nbCouchesJTF = nbCouchesJTF;
    }

    public JLabel getNbCouchesLab() {
        return nbCouchesLab;
    }

    public void setNbCouchesLab(JLabel nbCouchesLab) {
        this.nbCouchesLab = nbCouchesLab;
    }

    public JTextField getNbEntree() {
        return nbInput;
    }

    public void setNbEntree(JTextField nbEntree) {
        this.nbInput = nbEntree;
    }

    public JLabel getNbEntreeLab() {
        return nbInputLab;
    }

    public void setNbEntreeLab(JLabel nbEntreeLab) {
        this.nbInputLab = nbEntreeLab;
    }

    public int getNbExempleMax() {
        return nbExempleMax;
    }

    public void setNbExempleMax(int nbExempleMax) {
        this.nbExempleMax = nbExempleMax;
    }

    public int getNbIn() {
        return nbIn;
    }

    public void setNbIn(int nbIn) {
        this.nbIn = nbIn;
    }

    public int getNbIterationsMax() {
        return nbIterationsMax;
    }

    public void setNbIterationsMax(int nbIterationsMax) {
        this.nbIterationsMax = nbIterationsMax;
    }

    public int getNbOut() {
        return nbOut;
    }

    public void setNbOut(int nbOut) {
        this.nbOut = nbOut;
    }

    public JTextField getNbSortie() {
        return nbSortie;
    }

    public void setNbSortie(JTextField nbSortie) {
        this.nbSortie = nbSortie;
    }

    public JLabel getNbSortieLab() {
        return nbSortieLab;
    }

    public void setNbSortieLab(JLabel nbSortieLab) {
        this.nbSortieLab = nbSortieLab;
    }

    public String getNomExp() {
        return nomExp;
    }

    public void setNomExp(String nomExp) {
        this.nomExp = nomExp;
    }

    public JTextField getNomExperience() {
        return nomExperience;
    }

    public void setNomExperience(JTextField nomExperience) {
        this.nomExperience = nomExperience;
    }

    public JLabel getNomExperienceLab() {
        return nomExperienceLab;
    }

    public void setNomExperienceLab(JLabel nomExperienceLab) {
        this.nomExperienceLab = nomExperienceLab;
    }

    public String getNomPMC() {
        return nomPMC;
    }

    public void setNomPMC(String nomPMC) {
        this.nomPMC = nomPMC;
    }

    public JTextField getNomPMCField() {
        return nomPMCField;
    }

    public void setNomPMCField(JTextField nomPMCField) {
        this.nomPMCField = nomPMCField;
    }

    public JLabel getNomPMCLab() {
        return nomPMCLab;
    }

    public void setNomPMCLab(JLabel nomPMCLab) {
        this.nomPMCLab = nomPMCLab;
    }

    public JPanel getNonchargeSparse() {
        return nonchargeSparse;
    }

    public void setNonchargeSparse(JPanel nonchargeSparse) {
        this.nonchargeSparse = nonchargeSparse;
    }

    public JPanel getNonsparseApp() {
        return nonsparseApp;
    }

    public void setNonsparseApp(JPanel nonsparseApp) {
        this.nonsparseApp = nonsparseApp;
    }

    public JPanel getNonsparseAppY() {
        return nonsparseAppY;
    }

    public void setNonsparseAppY(JPanel nonsparseAppY) {
        this.nonsparseAppY = nonsparseAppY;
    }

    public JFileChooser getNonsparseChooser() {
        return nonsparseChooser;
    }

    public void setNonsparseChooser(JFileChooser nonsparseChooser) {
        this.nonsparseChooser = nonsparseChooser;
    }

    public JButton getNonsparseChooserBoutonApp() {
        return nonsparseChooserBoutonApp;
    }

    public void setNonsparseChooserBoutonApp(JButton nonsparseChooserBoutonApp) {
        this.nonsparseChooserBoutonApp = nonsparseChooserBoutonApp;
    }

    public JButton getNonsparseChooserBoutonAppY() {
        return nonsparseChooserBoutonAppY;
    }

    public void setNonsparseChooserBoutonAppY(JButton nonsparseChooserBoutonAppY) {
        this.nonsparseChooserBoutonAppY = nonsparseChooserBoutonAppY;
    }

    public JButton getNonsparseChooserBoutonTest() {
        return nonsparseChooserBoutonTest;
    }

    public void setNonsparseChooserBoutonTest(JButton nonsparseChooserBoutonTest) {
        this.nonsparseChooserBoutonTest = nonsparseChooserBoutonTest;
    }

    public JButton getNonsparseChooserBoutonTestY() {
        return nonsparseChooserBoutonTestY;
    }

    public void setNonsparseChooserBoutonTestY(JButton nonsparseChooserBoutonTestY) {
        this.nonsparseChooserBoutonTestY = nonsparseChooserBoutonTestY;
    }

    public JTextField getNonsparseChooserFieldApp() {
        return nonsparseChooserFieldApp;
    }

    public void setNonsparseChooserFieldApp(JTextField nonsparseChooserFieldApp) {
        this.nonsparseChooserFieldApp = nonsparseChooserFieldApp;
    }

    public JTextField getNonsparseChooserFieldAppY() {
        return nonsparseChooserFieldAppY;
    }

    public void setNonsparseChooserFieldAppY(JTextField nonsparseChooserFieldAppY) {
        this.nonsparseChooserFieldAppY = nonsparseChooserFieldAppY;
    }

    public JTextField getNonsparseChooserFieldTest() {
        return nonsparseChooserFieldTest;
    }

    public void setNonsparseChooserFieldTest(JTextField nonsparseChooserFieldTest) {
        this.nonsparseChooserFieldTest = nonsparseChooserFieldTest;
    }

    public JTextField getNonsparseChooserFieldTestY() {
        return nonsparseChooserFieldTestY;
    }

    public void setNonsparseChooserFieldTestY(JTextField nonsparseChooserFieldTestY) {
        this.nonsparseChooserFieldTestY = nonsparseChooserFieldTestY;
    }

    public JLabel getNonsparseChooserLabApp() {
        return nonsparseChooserLabApp;
    }

    public void setNonsparseChooserLabApp(JLabel nonsparseChooserLabApp) {
        this.nonsparseChooserLabApp = nonsparseChooserLabApp;
    }

    public JLabel getNonsparseChooserLabAppY() {
        return nonsparseChooserLabAppY;
    }

    public void setNonsparseChooserLabAppY(JLabel nonsparseChooserLabAppY) {
        this.nonsparseChooserLabAppY = nonsparseChooserLabAppY;
    }

    public JLabel getNonsparseChooserLabTest() {
        return nonsparseChooserLabTest;
    }

    public void setNonsparseChooserLabTest(JLabel nonsparseChooserLabTest) {
        this.nonsparseChooserLabTest = nonsparseChooserLabTest;
    }

    public JLabel getNonsparseChooserLabTestY() {
        return nonsparseChooserLabTestY;
    }

    public void setNonsparseChooserLabTestY(JLabel nonsparseChooserLabTestY) {
        this.nonsparseChooserLabTestY = nonsparseChooserLabTestY;
    }

    public JPanel getNonsparseTest() {
        return nonsparseTest;
    }

    public void setNonsparseTest(JPanel nonsparseTest) {
        this.nonsparseTest = nonsparseTest;
    }

    public JPanel getNonsparseTestY() {
        return nonsparseTestY;
    }

    public void setNonsparseTestY(JPanel nonsparseTestY) {
        this.nonsparseTestY = nonsparseTestY;
    }

    public JMenuItem getNouveau() {
        return nouveau;
    }

    public void setNouveau(JMenuItem nouveau) {
        this.nouveau = nouveau;
    }

    public JMenuItem getOuvrir() {
        return ouvrir;
    }

    public void setOuvrir(JMenuItem ouvrir) {
        this.ouvrir = ouvrir;
    }

    public JPanel getPanneauControl() {
        return panneauControl;
    }

    public void setPanneauControl(JPanel panneauControl) {
        this.panneauControl = panneauControl;
    }

    public JPanel getPanneauGauche() {
        return panneauGauche;
    }

    public void setPanneauGauche(JPanel panneauGauche) {
        this.panneauGauche = panneauGauche;
    }

    public JPanel getParam() {
        return param;
    }

    public void setParam(JPanel param) {
        this.param = param;
    }

    public ArrayList<Integer> getParamCouches() {
        return paramCouches;
    }

    public void setParamCouches(ArrayList<Integer> paramCouches) {
        this.paramCouches = paramCouches;
    }

    public JButton getPermuterBut() {
        return permuterBut;
    }

    public void setPermuterBut(JButton permuterBut) {
        this.permuterBut = permuterBut;
    }

    public String getPermutname() {
        return permutname;
    }

    public void setPermutname(String permutname) {
        this.permutname = permutname;
    }

    public JButton getPlay() {
        return play;
    }

    public void setPlay(JButton play) {
        this.play = play;
    }

    public Font getPolice() {
        return police;
    }

    public void setPolice(Font police) {
        this.police = police;
    }

    public JMenuItem getSauver() {
        return sauver;
    }

    public void setSauver(JMenuItem sauver) {
        this.sauver = sauver;
    }

    public boolean isSave() {
        return save;
    }

    public void setSave(boolean save) {
        this.save = save;
    }

    public JCheckBox getSaveBox() {
        return saveBox;
    }

    public void setSaveBox(JCheckBox saveBox) {
        this.saveBox = saveBox;
    }

    public JLabel getSaveBoxLab() {
        return saveBoxLab;
    }

    public void setSaveBoxLab(JLabel saveBoxLab) {
        this.saveBoxLab = saveBoxLab;
    }

    public String getSortie() {
        return sortie;
    }

    public void setSortie(String sortie) {
        this.sortie = sortie;
    }

    public JCheckBox getSparse() {
        return sparse;
    }

    public void setSparse(JCheckBox sparse) {
        this.sparse = sparse;
    }

    public JPanel getSparseApp() {
        return sparseApp;
    }

    public void setSparseApp(JPanel sparseApp) {
        this.sparseApp = sparseApp;
    }

    public JFileChooser getSparseChooser() {
        return sparseChooser;
    }

    public void setSparseChooser(JFileChooser sparseChooser) {
        this.sparseChooser = sparseChooser;
    }

    public JButton getSparseChooserBoutonApp() {
        return sparseChooserBoutonApp;
    }

    public void setSparseChooserBoutonApp(JButton sparseChooserBoutonApp) {
        this.sparseChooserBoutonApp = sparseChooserBoutonApp;
    }

    public JButton getSparseChooserBoutonTest() {
        return sparseChooserBoutonTest;
    }

    public void setSparseChooserBoutonTest(JButton sparseChooserBoutonTest) {
        this.sparseChooserBoutonTest = sparseChooserBoutonTest;
    }

    public JTextField getSparseChooserFieldApp() {
        return sparseChooserFieldApp;
    }

    public void setSparseChooserFieldApp(JTextField sparseChooserFieldApp) {
        this.sparseChooserFieldApp = sparseChooserFieldApp;
    }

    public JTextField getSparseChooserFieldTest() {
        return sparseChooserFieldTest;
    }

    public void setSparseChooserFieldTest(JTextField sparseChooserFieldTest) {
        this.sparseChooserFieldTest = sparseChooserFieldTest;
    }

    public JLabel getSparseChooserLabApp() {
        return sparseChooserLabApp;
    }

    public void setSparseChooserLabApp(JLabel sparseChooserLabApp) {
        this.sparseChooserLabApp = sparseChooserLabApp;
    }

    public JLabel getSparseChooserLabTest() {
        return sparseChooserLabTest;
    }

    public void setSparseChooserLabTest(JLabel sparseChooserLabTest) {
        this.sparseChooserLabTest = sparseChooserLabTest;
    }

    public JPanel getSparsePan() {
        return sparsePan;
    }

    public void setSparsePan(JPanel sparsePan) {
        this.sparsePan = sparsePan;
    }

    public JPanel getSparseTest() {
        return sparseTest;
    }

    public void setSparseTest(JPanel sparseTest) {
        this.sparseTest = sparseTest;
    }

    public boolean isSparsebool() {
        return sparsebool;
    }

    public void setSparsebool(boolean sparsebool) {
        this.sparsebool = sparsebool;
    }

    public JSplitPane getSplit() {
        return split;
    }

    public void setSplit(JSplitPane split) {
        this.split = split;
    }

    public JSplitPane getSplit1() {
        return split1;
    }

    public void setSplit1(JSplitPane split1) {
        this.split1 = split1;
    }

    public JPanel getStatcourbe() {
        return statcourbe;
    }

    public void setStatcourbe(JPanel statcourbe) {
        this.statcourbe = statcourbe;
    }

    public JPanel getStatfree() {
        return statfree;
    }

    public void setStatfree(JPanel statfree) {
        this.statfree = statfree;
    }

    public JScrollPane getStatfreeScrollBar() {
        return statfreeScrollBar;
    }

    public void setStatfreeScrollBar(JScrollPane statfreeScrollBar) {
        this.statfreeScrollBar = statfreeScrollBar;
    }

    public JLabel getStatlabinfo() {
        return statlabinfo;
    }

    public void setStatlabinfo(JLabel statlabinfo) {
        this.statlabinfo = statlabinfo;
    }

    public Stats getStats() {
        return stats;
    }

    public void setStats(Stats stats) {
        this.stats = stats;
    }

    public int[] getTabNbNeur() {
        return tabNbNeur;
    }

    public void setTabNbNeur(int[] tabNbNeur) {
        this.tabNbNeur = tabNbNeur;
    }

    public JToolBar getToolBar() {
        return toolBar;
    }

    public void setToolBar(JToolBar toolBar) {
        this.toolBar = toolBar;
    }

    public boolean isTrain() {
        return train;
    }

    public void setTrain(boolean train) {
        this.train = train;
    }

    public JCheckBox getTrainBox() {
        return trainBox;
    }

    public void setTrainBox(JCheckBox trainBox) {
        this.trainBox = trainBox;
    }

    public JLabel getTrainBoxLab() {
        return trainBoxLab;
    }

    public void setTrainBoxLab(JLabel trainBoxLab) {
        this.trainBoxLab = trainBoxLab;
    }

    public JCheckBox getCurricBox() {
        return CurricBox;
    }

    public void setCurricBox(JCheckBox CurricBox) {
        this.CurricBox = CurricBox;
    }

    public JLabel getCurricBoxLab() {
        return CurricBoxLab;
    }

    public void setCurricBoxLab(JLabel CurricBoxLab) {
        this.CurricBoxLab = CurricBoxLab;
    }

    public JTextField getNbExemples() {
        return nbExemplesTest;
    }

    public void setNbExemples(JTextField nbExemples) {
        this.nbExemplesTest = nbExemples;
    }

    public JLabel getNbExemplesLab() {
        return nbExemplesLabTest;
    }

    public void setNbExemplesLab(JLabel nbExemplesLab) {
        this.nbExemplesLabTest = nbExemplesLab;
    }

    public JTextField getNbIteration() {
        return nbIterationInit;
    }

    public void setNbIteration(JTextField nbIteration) {
        this.nbIterationInit = nbIteration;
    }

    public JLabel getNbIterationLab() {
        return nbIterationInitLab;
    }

    public void setNbIterationLab(JLabel nbIterationLab) {
        this.nbIterationInitLab = nbIterationLab;
    }

    public JCheckBox getCurricBox2() {
        return CurricBox2;
    }

    public void setCurricBox2(JCheckBox CurricBox2) {
        this.CurricBox2 = CurricBox2;
    }

    public JLabel getCurricBoxLab2() {
        return CurricBoxLab2;
    }

    public void setCurricBoxLab2(JLabel CurricBoxLab2) {
        this.CurricBoxLab2 = CurricBoxLab2;
    }

    public gestControler getCont() {
        return cont;
    }

    public void setCont(gestControler cont) {
        this.cont = cont;
    }

    public JTextField getJfieldtaux() {
        return jfieldtaux;
    }

    public void setJfieldtaux(JTextField jfieldtaux) {
        this.jfieldtaux = jfieldtaux;
    }

    public JLabel getJlabtaux() {
        return jlabtaux;
    }

    public void setJlabtaux(JLabel jlabtaux) {
        this.jlabtaux = jlabtaux;
    }

    public gestModele getModele() {
        return modele;
    }

    public void setModele(gestModele modele) {
        this.modele = modele;
    }

    public JTextField getNbExempleApp() {
        return nbExempleApp;
    }

    public void setNbExempleApp(JTextField nbExempleApp) {
        this.nbExempleApp = nbExempleApp;
    }

    public JLabel getNbExempleAppLab() {
        return nbExempleAppLab;
    }

    public void setNbExempleAppLab(JLabel nbExempleAppLab) {
        this.nbExempleAppLab = nbExempleAppLab;
    }

    public JLabel getNbExemplesLabTest() {
        return nbExemplesLabTest;
    }

    public void setNbExemplesLabTest(JLabel nbExemplesLabTest) {
        this.nbExemplesLabTest = nbExemplesLabTest;
    }

    public JTextField getNbExemplesTest() {
        return nbExemplesTest;
    }

    public void setNbExemplesTest(JTextField nbExemplesTest) {
        this.nbExemplesTest = nbExemplesTest;
    }

    public JTextField getNbInput() {
        return nbInput;
    }

    public void setNbInput(JTextField nbInput) {
        this.nbInput = nbInput;
    }

    public JLabel getNbInputLab() {
        return nbInputLab;
    }

    public void setNbInputLab(JLabel nbInputLab) {
        this.nbInputLab = nbInputLab;
    }

    public JTextField getNbIterationInit() {
        return nbIterationInit;
    }

    public void setNbIterationInit(JTextField nbIterationInit) {
        this.nbIterationInit = nbIterationInit;
    }

    public JLabel getNbIterationInitLab() {
        return nbIterationInitLab;
    }

    public void setNbIterationInitLab(JLabel nbIterationInitLab) {
        this.nbIterationInitLab = nbIterationInitLab;
    }

    public JTextField getNbIterationMax() {
        return nbIterationMax;
    }

    public void setNbIterationMax(JTextField nbIterationMax) {
        this.nbIterationMax = nbIterationMax;
    }

    public JLabel getNbIterationMaxLab() {
        return nbIterationMaxLab;
    }

    public void setNbIterationMaxLab(JLabel nbIterationMaxLab) {
        this.nbIterationMaxLab = nbIterationMaxLab;
    }

    public JTextField getPasInput() {
        return pasInput;
    }

    public void setPasInput(JTextField pasInput) {
        this.pasInput = pasInput;
    }

    public JLabel getPasInputLab() {
        return pasInputLab;
    }

    public void setPasInputLab(JLabel pasInputLab) {
        this.pasInputLab = pasInputLab;
    }

    public double getTaux() {
        return taux;
    }

    public void setTaux(double taux) {
        this.taux = taux;
    }

    public JTextField getNbIterationCurric() {
        return nbIterationCurric;
    }

    public void setNbIterationCurric(JTextField nbIterationCurric) {
        this.nbIterationCurric = nbIterationCurric;
    }

    public JLabel getNbIterationCurricLab() {
        return nbIterationCurricLab;
    }

    public void setNbIterationCurricLab(JLabel nbIterationCurricLab) {
        this.nbIterationCurricLab = nbIterationCurricLab;
    }

    


	







}



